package com.gs.SynPatrolRep.util;

import com.gs.SynPatrolRep.MyApplication;

public class DensityUtil {

    public static int dp2px(float dp) {
        float scale = MyApplication.getContext().getResources().getDisplayMetrics().density;
        return (int) (dp * scale + 0.5f);
    }

    public static int px2sp(float sp) {
        float scale = MyApplication.getContext().getResources().getDisplayMetrics().scaledDensity;
        return (int) (sp * scale + 0.5f);
    }
}
